/*    */package nc.ui.med.pub.sourceref;

import nc.bs.logging.Logger;
import nc.vo.cache.CacheManager;
import nc.vo.cache.ICache;
import nc.vo.cache.config.CacheConfig;
import nc.vo.cache.exception.CacheException;


public class UserBillConfigCache {
	private static String fileRegion = "SCM_UserBillConfigCache";

	private static String prev_billref = "SCM_BillRef";

	private static ICache getTempletCache() {
		CacheConfig config = new CacheConfig();

		config.setRegionName(fileRegion);
		config.setCacheType(CacheConfig.CacheType.DYNAMIC_FILE);

		ICache cache = CacheManager.getInstance().getCache(config);

		return cache;
	}

	public static Boolean getBillRefModeSel(String pk_corp, String sBizType,
			String srcBillType, String dstBillType, String soperator) {

		String cacheKey = prev_billref + pk_corp + srcBillType + dstBillType
				+ soperator;
		try {
			return (Boolean) getTempletCache().get(cacheKey);
		} catch (CacheException e) {
			Logger.error(e.getMessage());
		}
		return null;
	}

	public static void saveBillRefModeSel(String pk_corp, String sBizType,
			String srcBillType, String dstBillType, String soperator,
			Boolean value) {
		if (value == null)
			return;
		String cacheKey = prev_billref + pk_corp + srcBillType + dstBillType
				+ soperator;
		try {
			getTempletCache().put(cacheKey, value);
		} catch (CacheException e) {
			Logger.error(e.getMessage());
		}
	}

}